#!/usr/bin/env python
# Owners = Seamus, Arman
# Conducts a benchmark test
# Outputs a graph to view the results
# Lab 5

import os
pings = raw_input('Enter number of requests: ')
threads = raw_input('Enter number of threads: ')
filename = raw_input('Enter the file name to export the data: ')
print('Requesting http://localhost/app/')
os.system("ab -n "+pings+" -c "+threads+" -g "+filename+" http://localhost/app/")
print('Benchmarking should have been complete..')
raw_input('Press any key to try drawing graph with gnuplot..')
if os.path.isfile(filename):
	print('Found '+filename+'...Drawing the graph now with bezier curves..')
	image = raw_input('Enter image name for exporting..: ')
	os.system("gnuplot -e 'set terminal png; set output \""+image+"\"; plot \""+filename+"\" using 9'")
else:
	print("looks like we couldn't find the file you're looking for..Exiting..")





